package com.catchu.pattern.creational.构造器模式.bill;

/**
 * 账单指导器
 */
public class BillDirector {

    private IBillBuilder billBuilder;

    public BillDirector(IBillBuilder billBuilder) {
        this.billBuilder = billBuilder;
    }

    /**
     * 根据订单来创建账单
     * @param order
     */
    public void concreteBill(Order order){
        billBuilder.buildBasicPrice(order.getUnitPrice());
        billBuilder.buildTax();
        if(order.isVIP()){
            billBuilder.buildDiscount();
        }
        billBuilder.buildFreight();

    }
}
